<div class="wrapper wrapper-content fadeInRight" ng-controller="AccessListCtr">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>菜单列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-10 pull-left">
                            <form class="form-inline">
                                <!-- <div class="form-group">
                                    <label class="control-label">类型</label>
                                    <select class="form-control" ng-model="search.type" ng-change="getList()">
                                        <option value="1">后台</option>
                                        <option value="2">前台</option>
                                    </select>
                                </div> -->
                                <div class="form-group">
                                    <label class="control-label">父级:</label>
                                    <select class="form-control" ng-model="search.pid">
                                        <option value="">全部</option>
                                        <option value="0">一级</option>
                                        <option ng-repeat="option in data.parentMenu" value="{{option.id}}"
                                                ng-selected="option.id == search.pid">{{option.name}}
                                        </option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" placeholder="key" ng-model="search.key">
                                </div>
                                <button class="btn btn-success" ng-click="getList()">搜索</button>
                            </form>
                        </div>
                        <div class="col-sm-1 pull-right">
                            <div class="input-group">
                                <a class="btn btn-sm btn-success" access="AccessAccessSave" ng-click="showEdit()">
                                    新增</a>
                            </div>
                        </div>
                    </div>

                    <table class="table table-bordered table-hover" style="text-align: center;">
                        <thead>
                        <tr>
                            <td>序号</td>
                            <td>名称</td>
                            <td>父级</td>
                            <td>key</td>
                            <td>链接</td>
                            <td>是菜单</td>
                            <td>创建时间</td>
                            <td>操作</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="item in data.list">
                            <td>{{item.id}}</td>
                            <td>{{item.name}}</td>
                            <td>{{item.pid}}</td>
                            <td>{{item.key}}</td>
                            <td>{{item.url}}</td>
                            <td>{{item.menu ? '是' : '否'}}</td>
                            <td>{{item.create_time}}</td>
                            <td>
                                <a access="AccessAccessSave" ng-click="showEdit($index+1)">编辑</a>
                                <a access="AccessAccessDel" ng-click="del(item)">删除</a>
                            </td>
                        </tr>
                        <tr ng-if="data.list.length == 0">
                            <td colspan="8">暂无数据</td>
                        </tr>
                        </tbody>
                    </table>
                    <div admin-page="data.pages" curr-page="search.page" datas-count="data.count"
                         callback="getList"></div>
                </div>

            </div>

        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">编辑</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="editAccessForm">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">名称:</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="name" ng-model="edit.name"
                                       required="true">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">父级:</label>
                            <div class="col-sm-8">
                                <select class="form-control" ng-model="edit.pid" name="pid"
                                        ng-options="item.id as item.name for item in data.editParentMenu">
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">icon:</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="icon" ng-model="edit.icon">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">url:</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="url" ng-model="edit.url"
                                       placeholder="controller/action">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">key:</label>
                            <div class="col-sm-8">
                                <input class="form-control" type="text" name="key" ng-model="edit.key">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否是菜单:</label>
                            <div class="col-sm-8">
                                <label class="radio-inline">
                                    <input type="radio" name="menu" id="menu1" value="1" ng-model="edit.menu"> 是
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="menu" id="menu2" value="0" ng-model="edit.menu"> 否
                                </label>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" ng-click="commit()" access="AccessAccessSave">保存
                    </button>
                </div>
            </div>
        </div>
    </div>

</div>